package com.hogwarts.webui;

import com.hogwarts.base.WebUIBase;
import com.hogwarts.webui.pageobj.BingOps;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.apache.log4j.Logger;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;

@Feature("WebUI PO模式例子")
public class WebUITestPageObj extends WebUIBase {
    private Logger logger = Logger.getLogger(WebUITestPageObj.class);

    @Test
    @Story("Bing搜索")
    public void bingPO() throws IOException {
        navigation.to("https://cn.bing.com/");
        BingOps.inputText(driver, "PO模式");
        String imgPath1 = projRootPath + File.separator + "testdata" + File.separator + "bing_input"
                + System.currentTimeMillis() + ".png";
        logger.info("保存图像路径" + imgPath1);
        BingOps.takeScreenshot(driver, imgPath1);

        BingOps.clickSearch(driver);
        wait5s();
        String imgPath2 = projRootPath + File.separator + "testdata" + File.separator + "bing_search"
                + System.currentTimeMillis() + ".png";
        logger.info("保存图像路径" + imgPath2);
        BingOps.takeScreenshot(driver, imgPath2);
    }

}
